﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core.DataAccess.Interfaces;
using Core.Logic.Interfaces;
using Core.Relations;

namespace Core.Logic.Implementations
{
    public class LogicProvider<T>:ILogicProvider<T> 
    {

        protected IModelDataProvider<T> ModelDataProvider;
        protected DataProviderFactory DataProviderFactory;//?

        public LogicProvider(IModelDataProvider<T> modelDataProvider )
        {
            ModelDataProvider = modelDataProvider;
            DataProviderFactory = new DataProviderFactory();
        }

        #region Implementation of ILogicProvider<T>

        public virtual T Save(T entity)
        {
           return ModelDataProvider.Save(entity);
        }

        public IList<T> GetAll()
        {
            return ModelDataProvider.GetAll();
        }

        public T Get<U>(U id)
        {
           return ModelDataProvider.Get(id);
        }

        public virtual void Delete<U>(U Id)
        {
            ModelDataProvider.Delete(Id);
        }

        public virtual T Update(T entity)
        {
           return ModelDataProvider.Update(entity);
        }

        #endregion
    }
}
